UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2nqvcsLwcwk9KrFE04CFozvKgchYR8V3f9W1T9m1zeo='
WHERE
key_id = 'c434a992a6d1dd61266f9fb28357b4fc764e8baa03616a54e5471e3a72448361'
AND (
token = '2nqvcsLwcwk9KrFE04CFozvKgchYR8V3f9W1T9m1zeo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)