UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ArZrT6/wfXCa9dT/YxOhML+qs2MuyUmce9SioA9q+n0=' 
WHERE 
  key_id = '3d54f539a6aac327b90a582ef74fa2f4b49116f7114160750234dd1616bce85e' 
  AND (
    token = 'ArZrT6/wfXCa9dT/YxOhML+qs2MuyUmce9SioA9q+n0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034