UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2tlyZTMYEWhSfrprrvb8RHW41piCqAtzOG1GbnJ7vHg='
WHERE
key_id = '4d313c5de8881690fb0cf77edfea81d8e1eea131f0822e493ec9f1eecb3021e9'
AND (
token = '2tlyZTMYEWhSfrprrvb8RHW41piCqAtzOG1GbnJ7vHg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)