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