UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N6QZE8TO49lga8zYwFfRowQA+/MHPMd9k7UfjC4aw8w='
WHERE
key_id = '3b127e9f3f727523c06895eb7bd0196ff17113562e387f84c9b64534d2662e1f'
AND (
token = 'N6QZE8TO49lga8zYwFfRowQA+/MHPMd9k7UfjC4aw8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)