UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NpbF2AsLGl24I7cFm4TylAJbDSZpAvaygvffWlN3QUo=' 
WHERE 
  key_id = 'c3a8d21fc28236fd94cfdc587eb60d22229aee141ae180d92526271b43302541' 
  AND (
    token = 'NpbF2AsLGl24I7cFm4TylAJbDSZpAvaygvffWlN3QUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043