UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gNUw5RYofjjzfixASkGLdPGEkc/74trgUlng7a1MUpU='
WHERE
key_id = '887abc9d1329160a805688e7dfc2a077f3f17e8e9ad4acdbaf0d10fb38bacc7d'
AND (
token = 'gNUw5RYofjjzfixASkGLdPGEkc/74trgUlng7a1MUpU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)