UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1y4+pvYzxNpXD6ujxzSyss615oJy66b3KyOXW4liyGU='
WHERE
key_id = 'd1fbf764ff8d3319fe4d4ce23c1f5a62b79a256a843c499661ac99bf26937780'
AND (
token = '1y4+pvYzxNpXD6ujxzSyss615oJy66b3KyOXW4liyGU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)