UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rg4AGs5ONr0HXc6qCfUmDZKWH6b3bIZA5eOcy4UUyvs=' 
WHERE 
  key_id = '83d7c1f951a5be47e2c8e740be366afcbb01c8be24dca6bca4c39e476f857593' 
  AND (
    token = 'Rg4AGs5ONr0HXc6qCfUmDZKWH6b3bIZA5eOcy4UUyvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062