UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aTYnVvaGx40awbYNRfLc18TnZQMUWsUb5yZMQdZvSG0='
WHERE
key_id = '5aaadb5862f6242ef90b65d3310b3272b76b3c453f222523548a4dc5c0ff1fc8'
AND (
token = 'aTYnVvaGx40awbYNRfLc18TnZQMUWsUb5yZMQdZvSG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)