UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nxTerIP6vwi/sjH13N1wTDklA7stndEsEkzX1L20L50='
WHERE
key_id = '9719a10591dee07609855660b5ead40e06154d7241a9c0b8d38c7625ddf8b69d'
AND (
token = 'nxTerIP6vwi/sjH13N1wTDklA7stndEsEkzX1L20L50='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)