UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ODjr86GG3vf0WTGsiLWSMCsMMX0lKY4LZnlCnbCYkoE=' 
WHERE 
  key_id = '51c827dc6afec584b351c16c20aad8045c08075061b094483f063e8f9463f443' 
  AND (
    token = 'ODjr86GG3vf0WTGsiLWSMCsMMX0lKY4LZnlCnbCYkoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028