UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uPAqQqgfYvYZTSxSdKBuWxkf7TolmagSy1jeJdAC8V4='
WHERE
key_id = 'dc8ef39e072906355553207c7c435b448819b18f705145b2314a69f4d98f2d2b'
AND (
token = 'uPAqQqgfYvYZTSxSdKBuWxkf7TolmagSy1jeJdAC8V4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)