UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XCehDz7ZMDTt+to8PapIGBYlo0Tv49ohR7PxRYqLWx0='
WHERE
key_id = 'c1c80f5140dff1f935da4cf5375b377340b1a396441f7bcba86845526afbe217'
AND (
token = 'XCehDz7ZMDTt+to8PapIGBYlo0Tv49ohR7PxRYqLWx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)