UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TSG95N7xqTZTWowemNGNdTy8RUo5MzdcMP0SxcomTWA='
WHERE
key_id = 'bc958082d3a004ac576389ed473d4d0cce17d4f7383968aaad829971024835f4'
AND (
token = 'TSG95N7xqTZTWowemNGNdTy8RUo5MzdcMP0SxcomTWA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)