UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xJ7T0b3APm8BlNwpyAT0BXH5OZH5/0bVnRWmLqnW3SY=' 
WHERE 
  key_id = '062a8cf707977b30a66729baf809e2fdcccd0218ef7470b4a9a3bf8080264a65' 
  AND (
    token = 'xJ7T0b3APm8BlNwpyAT0BXH5OZH5/0bVnRWmLqnW3SY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046