UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tfjxq6wXEzT8lWZpigq4TDnRCsGX9ildkyvQdtXb5yE=' 
WHERE 
  key_id = '7ca98981220a3b982e6ffdecc909400e273f53b9e64ad03db531a193b6cb5138' 
  AND (
    token = 'Tfjxq6wXEzT8lWZpigq4TDnRCsGX9ildkyvQdtXb5yE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070