UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fW6r7Z0xe+ojUMnN6CjgPfpGY9Ht+gif2kCPZrQxgyA=' 
WHERE 
  key_id = '53531ef6f7e57e3c8653f33d07a76f520d55b77312d5d68f102407fda132ad7c' 
  AND (
    token = 'fW6r7Z0xe+ojUMnN6CjgPfpGY9Ht+gif2kCPZrQxgyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038