UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EnderVTSgfS1CyVdjA9CuhV0lVWoJadheEcz36WL+x8=' 
WHERE 
  key_id = '28e80bf13c03590ed551a52c9efa749bfe5aee9367c2198f1696e1068597a86e' 
  AND (
    token = 'EnderVTSgfS1CyVdjA9CuhV0lVWoJadheEcz36WL+x8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042