UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QNk056+H0jY0wG4HIm0o+x5MmdQAHKCwAlGxBbatNHs='
WHERE
key_id = '1562186ddd0203b6da2a605a25fbff02966fc9530fb9544c4bb7de24d0d8abab'
AND (
token = 'QNk056+H0jY0wG4HIm0o+x5MmdQAHKCwAlGxBbatNHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)