UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gPgdljl6ijO1Fub3U4mfcjwDyquycysTiEL9SyNnyk0=' 
WHERE 
  key_id = 'eecfd6296398ef467b56ded9e120eda4243e19e97bdebabf755ec73dd0454097' 
  AND (
    token = 'gPgdljl6ijO1Fub3U4mfcjwDyquycysTiEL9SyNnyk0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045