UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Rmri1eilQLJGrCBDrsdFnE23sX6tbt25h+aJCrIqfZw='
WHERE
key_id = '4501b7d711c43f1ff5bad007999054863ecc6c6450c13502820b023f80155dc6'
AND (
token = 'Rmri1eilQLJGrCBDrsdFnE23sX6tbt25h+aJCrIqfZw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)