UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7R7yDIp769b3dKlWR+vQ+74aVQdX+3ozxrNZ7wpcHs4=' 
WHERE 
  key_id = '80a4be538369e759d73d3bb037aa59799d59a4c54c8786c7b42efc5c621a600b' 
  AND (
    token = '7R7yDIp769b3dKlWR+vQ+74aVQdX+3ozxrNZ7wpcHs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032