UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3Gpsp4Y+SyIuNe3EtXFdJo7W5CIhgLW+1lakA2CC3Ps=' 
WHERE 
  key_id = 'c540a23af4257c975ad75ce082de27006d2f46a6b4da175ffebc0ba50e5f022c' 
  AND (
    token = '3Gpsp4Y+SyIuNe3EtXFdJo7W5CIhgLW+1lakA2CC3Ps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022