UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OY8T9i8c3n1dvCMwMUK+ZvKIXtTpZ687qnRGClRNNtc=' 
WHERE 
  key_id = '125fc0e39e65da7799f154021f49dd86e165c997298d584c96c66d35ce5d62a4' 
  AND (
    token = 'OY8T9i8c3n1dvCMwMUK+ZvKIXtTpZ687qnRGClRNNtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027