UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RDogwvtgyJGmoy73MLa92WSYnn7TJvaWdBeR3T6+HE8=' 
WHERE 
  key_id = '5012e31c259efbbde2bf24f3c7ef3e5f1d8fdb482a96c5d854e319952f92c3ba' 
  AND (
    token = 'RDogwvtgyJGmoy73MLa92WSYnn7TJvaWdBeR3T6+HE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036