UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hNJxsmsNKb+h9fF89FSHcXc88eBvgl1FLcWilQqTEss=' 
WHERE 
  key_id = '6bf264e05d92d5cbb97e21b84ec8425f70bcc34180b09ddc42778da06013ee44' 
  AND (
    token = 'hNJxsmsNKb+h9fF89FSHcXc88eBvgl1FLcWilQqTEss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029