UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JvBgkTgRqqBKDoTdvYrF1mjhaM/BqrJoptFHqDZzjHU='
WHERE
key_id = '77fea82997ca813d3af853ff57257ccf59bbcd05820243d923d39cf5549ae2ce'
AND (
token = 'JvBgkTgRqqBKDoTdvYrF1mjhaM/BqrJoptFHqDZzjHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)