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