UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wC9cqG7Tu+pFIuQ/r3qDUpoB20sEhJij4HyKX0JipRE='
WHERE
key_id = 'e991e6f0f9a662b80cfb830dab2c06f4b8378a83f32163ad2a437d9eda90188f'
AND (
token = 'wC9cqG7Tu+pFIuQ/r3qDUpoB20sEhJij4HyKX0JipRE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)