UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nO9c1XFYzI4dqpVk5IlhSyA1qtfO9ShHxkqO//4heBc='
WHERE
key_id = 'dc8dca768bf20f0b60e73388d6ede54fb03a3a5b7a3b17ebe658064da5080995'
AND (
token = 'nO9c1XFYzI4dqpVk5IlhSyA1qtfO9ShHxkqO//4heBc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)