UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+4GEaJVbvwq4j8uKkXIisRstFoSU6ArJZJ+9gMH9T1U=' 
WHERE 
  key_id = '1b895f1bc8197b95ac0dc866595c400614ad6c418cb6165b09eb0b13d52c32d3' 
  AND (
    token = '+4GEaJVbvwq4j8uKkXIisRstFoSU6ArJZJ+9gMH9T1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030