UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gK7V4BW+LltbhdJfSYRkKFwqQ3Pu0FVQsepAyIhexWY=' 
WHERE 
  key_id = '54e342bd257357326d275ae4a8804ffc95cd74d57b68cf8f3a11fc993502f122' 
  AND (
    token = 'gK7V4BW+LltbhdJfSYRkKFwqQ3Pu0FVQsepAyIhexWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030