UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iN7Nm/LPnz8ywUAdiqWe0oaUgcCV7D8dSVXe4rDJuw0=' 
WHERE 
  key_id = '991d8ce14ea9b0f82e836af5dad1bd61201eb6b58ca04aa1c523f0e7578b97c7' 
  AND (
    token = 'iN7Nm/LPnz8ywUAdiqWe0oaUgcCV7D8dSVXe4rDJuw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029