UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aAy0XKf870opQ/j2+cWl7PGfZeXxrFahCyQm+rhoAOk='
WHERE
key_id = 'bcdbe3325f44de8ceffc62a40cdc5a14c74ddc95d45e4b90f4708a1cab1bb2c7'
AND (
token = 'aAy0XKf870opQ/j2+cWl7PGfZeXxrFahCyQm+rhoAOk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)