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