UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0oB+yrNcXZZMoPeDYOphaFjOcL/KFmITIb2DCaXyEbI='
WHERE
key_id = 'c5ae362df3fd4dbd2236cff1e5877e7a6f5c9cb217f3e2ce14be16d24e6e4308'
AND (
token = '0oB+yrNcXZZMoPeDYOphaFjOcL/KFmITIb2DCaXyEbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)