UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L/a+wPrziQrP6ad4kJAIjrKgu91hQGwVYPA/cs89/Sw='
WHERE
key_id = 'c96261abab55fd3b24b137140ddbf2f7af0d4b6254932214432a8f1d5dfd0581'
AND (
token = 'L/a+wPrziQrP6ad4kJAIjrKgu91hQGwVYPA/cs89/Sw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)