UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bi52ShDXiyqSlMkUoVoQyWUtAswR8j+HmFxg9IRR8SQ='
WHERE
key_id = 'f4de99e82186e197d6b623f4c301f11fc77e526a37f938f7a6ce164ee815308b'
AND (
token = 'bi52ShDXiyqSlMkUoVoQyWUtAswR8j+HmFxg9IRR8SQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)