UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N5VRZr+WPQaY+KDz7AUX/x+nk9EKOHU5KN3Ox5+iKGk=' 
WHERE 
  key_id = '23b5c0852edf27f6821a754c912af9b9022f7552a6082f703985338c1877762c' 
  AND (
    token = 'N5VRZr+WPQaY+KDz7AUX/x+nk9EKOHU5KN3Ox5+iKGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034