UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iZh6Ou0pnMflOx/PGHCP91x3weg5YkkY1+AiPeKHW+g='
WHERE
key_id = 'c75cc94c97f357471dd4c152e39b3f35254ed2f20d00c36d2e3943329d5e4381'
AND (
token = 'iZh6Ou0pnMflOx/PGHCP91x3weg5YkkY1+AiPeKHW+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)