UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AiX3uMNZvAoJ1ieR3UygEnwTakQ9oKlw0+XPgoKzXCA='
WHERE
key_id = '526f049cda4853faecd161b5954a3fa161496d2d8c152524f924de462842fb51'
AND (
token = 'AiX3uMNZvAoJ1ieR3UygEnwTakQ9oKlw0+XPgoKzXCA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)