UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a1e96VtX/YPjIpYIW+xkvhC0pIR8153dhMy4/hclnBw='
WHERE
key_id = 'e8bed7c93bbabdc5a918c7efaf31b6095d6459b87008ad18d5243e36f550e9af'
AND (
token = 'a1e96VtX/YPjIpYIW+xkvhC0pIR8153dhMy4/hclnBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)