UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r2nv7X39nm07PQCfKh+0SePNjYvHqRui1Lp0max6FNs=' 
WHERE 
  key_id = '6721c10e91e4d76f2eb1cbc2512ba5dd33e729b1eaeefbbcad9725fd5d52c0fb' 
  AND (
    token = 'r2nv7X39nm07PQCfKh+0SePNjYvHqRui1Lp0max6FNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062