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