UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BqP8HDRxfHiDTQJPab5CrHfsFo1EeHQa1P7nnJqOud4='
WHERE
key_id = '67c87517cc7c33d62b850f9a6afba5b159fcbd2d1ad855493cb098d05b4f87c6'
AND (
token = 'BqP8HDRxfHiDTQJPab5CrHfsFo1EeHQa1P7nnJqOud4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)