UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IWsJ2ZSUx1j1fqnkv6Tkj0PKD+pnJ/HuBpyBAD2be+Y=' 
WHERE 
  key_id = '639547f0b96005115b6e7896b43efd3c8935214ab32c88faee6ab2853c9fcc7a' 
  AND (
    token = 'IWsJ2ZSUx1j1fqnkv6Tkj0PKD+pnJ/HuBpyBAD2be+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073