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