UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NgNzpXGebxSncWKq6zYff2qzW5zAxKgHM0pvzH1Lmbw='
WHERE
key_id = '5f817130f8c5895a7f4eccc70d3ff63bce47a3cd49f9fbae0121e6cf7dfb0c3d'
AND (
token = 'NgNzpXGebxSncWKq6zYff2qzW5zAxKgHM0pvzH1Lmbw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)