UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FDHzoo44Ee3w1WnjeI8zfH3z3QyzQBxTM9lvWxYl/QQ=' 
WHERE 
  key_id = '538f2b2569cf3e1bc6db1003c8677957abeaa372b87037095d50bc36b05bd0e7' 
  AND (
    token = 'FDHzoo44Ee3w1WnjeI8zfH3z3QyzQBxTM9lvWxYl/QQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032