UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ak5m5pnhazah0w6VZ6jypjQCyCuGhOxqrPm34G5qgDw='
WHERE
key_id = '8d3d961fff6739f69c2ce20e4cbdb83d25c7e99cc044de2422f2423862b7499f'
AND (
token = 'Ak5m5pnhazah0w6VZ6jypjQCyCuGhOxqrPm34G5qgDw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)