UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eggLxuu09M8KITgTfLWgCdeeNWT7GNaTmVumeYZRoQY=' 
WHERE 
  key_id = '40d401821b3aa684c6627753e1edf93c12adedf750d173bae1dce3e3972e8bea' 
  AND (
    token = 'eggLxuu09M8KITgTfLWgCdeeNWT7GNaTmVumeYZRoQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052