UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yDhxWtAOQMp+rflNWk5wyE1naMC20TMI+SOA7A8ka8A='
WHERE
key_id = 'dc33d5367561a38d20e669454d9dabcb88f88faee0498f94f63410a534751bc8'
AND (
token = 'yDhxWtAOQMp+rflNWk5wyE1naMC20TMI+SOA7A8ka8A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)