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