UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YFeUszddfr43qH8VPd3SpSBQtvi5E5Q09Ydy2nGocEU=' 
WHERE 
  key_id = '77e81a2167b3446d66e573e64dd5b6689ab2b5214a019ae232b12c18d0690491' 
  AND (
    token = 'YFeUszddfr43qH8VPd3SpSBQtvi5E5Q09Ydy2nGocEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028