UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HRX4FbV/4igWbvIYdd0iN6YFZkQrYWiHu5+FHhICmac='
WHERE
key_id = 'fe8b4aab27db71bb4c85873d26448474cf6eb99c571e5a8be24a96dce46c9f77'
AND (
token = 'HRX4FbV/4igWbvIYdd0iN6YFZkQrYWiHu5+FHhICmac='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)