UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z2/7c4CesJugoyeOjJSstqMYrOW1jnHW8bsIVSw0G9Y='
WHERE
key_id = 'ad0f7522b2d94b54d1641230f007e08c6aa533bac6a39af4eb409c2361f5071d'
AND (
token = 'z2/7c4CesJugoyeOjJSstqMYrOW1jnHW8bsIVSw0G9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)